package org.nepu.scr.indexrate.converter.compliancerate.keyperformanceindicator;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.keyperformanceindicator.DrillingMachineBasicParameter;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class DrillingMachineBasicParameterConverter implements AttributeConverter<DrillingMachineBasicParameter, String> {
    @Override
    public String convertToDatabaseColumn(DrillingMachineBasicParameter drillingMachineBasicParameter) {
        return JSONUtil.toJsonStr(drillingMachineBasicParameter);
    }

    @Override
    public DrillingMachineBasicParameter convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, DrillingMachineBasicParameter.class);
    }
}
